package com.jt.provider.controller;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

@Component
public class DefaultRequestOriginParser implements RequestOriginParser {

    @Override
    public String parseOrigin(HttpServletRequest request) {
        //对请求参数进行解析，并返回参数值，然后将这个值应用在sentinel的授权规则中
        //http://ip:port/path?origin=xxx
        String origin = request.getParameter("origin");//这里的名字为参数名
        return origin;

    }
}
